package com.cc.service.impl;

import com.cc.entity.Products;
import com.cc.mapper.ProductsMapper;
import com.cc.service.ProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductsServiceImpl implements ProductsService {
    @Autowired
    private ProductsMapper productsMapper;
    @Override
    public List<Products> list(Products products) {
        return productsMapper.findAllProducts();
    }

    @Override
    public int add(Products products) {
        return productsMapper.addProducts(products);
    }

    @Override
    public int update(Products products) {
        return productsMapper.updateProducts(products);
    }

    @Override
    public int delete(Integer productId) {
        return productsMapper.deleteProducts(productId);
    }

    @Override
    public Products findById(Integer productId) {
        return productsMapper.findById(productId);
    }
}
